import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Find from '@/views/Find'
import Home from '@/views/Home'
import Consulting from '@/views/Consulting'
import My from '@/views/My'
import Login from '@/views/Login'
import CityList from '@/views/CityList'
import Collect from '@/views/Collect'
import Rent from '@/views/Rent'
import Map from '@/views/Map'
import Renting from '@/views/Renting'
import Detail from '@/views/Detail'
import RentSearch from '@/views/RentSearch'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/home'
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      {
        path: '/layout/home',
        component: Home
      },
      {
        path: '/layout/consulting',
        component: Consulting
      },
      {
        path: '/layout/find',
        component: Find
      },
      {
        path: '/layout/my',
        component: My
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/citylist',
    component: CityList
  },
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/rent',
    component: Rent
  },
  {
    path: '/map',
    component: Map
  },
  {
    path: '/renting',
    component: Renting
  },
  {
    path: '/detail/:id',
    component: Detail,
    name: 'detail'
    // props: true // 开启 Props 传参，说白了就是把路由参数映射到组件的 props 数据中
  },
  {
    path: '/rentsearch',
    component: RentSearch
  }
]

const router = new VueRouter({
  routes
})

export default router
